#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python

#The definition for the SR830 Lockin amplifier

from GPIB_upperclass import GPIB_wrapper
import random,os,sys
home_path=os.getcwd()+os.sep#Current path to this program
sys.path.append(home_path+"src"+os.sep+"pyvisa")
from ..visa import *

		
class Lakeshore455:
	
	def __init__(self,add="GPIB0::14::INSTR",test=True):
		"""Constructor"""
		self.address=add
		self.isTest=test
		#self.gpib=GpibInstrument(add)
		self.gpib=GPIB_wrapper(add,test)
		self.gpib.write("RDGMODE 1,3,1,1,1")

	def Measure_Field(self):
		"""returns:
			- the field in mT"""
		command="RDGFIELD?"
		self.gpib.write(command)
		save=self.gpib.read("scientific")
		return save*1000 #return the field in mT
	